Page({
    data: {
        daxiaoxz: ['水课', '专业必修'],
        daxiaoxzIndex: 0,
        username: '',
        phone: '',
        address: '',
        fee: '',
        remarks: ''
    },
    bindUsernameInput: function(e) {
        this.setData({
            username: e.detail.value
        });
    },
    bindPhoneInput: function(e) {
        this.setData({
            phone: e.detail.value
        });
    },
    bindAddressInput: function(e) {
        this.setData({
            address: e.detail.value
        });
    },
    bindFeeInput: function(e) {
        this.setData({
            fee: e.detail.value
        });
    },
    bindRemarksInput: function(e) {
        this.setData({
            remarks: e.detail.value
        });
    },
    submitForm: function() {
        if (!this.data.username || !this.data.phone || !this.data.address) {
            wx.showToast({
                title: '请确保信息完整',
                icon: 'none'
            });
            return;
        }
        if (!this.validatePhone(this.data.phone)) {
            wx.showToast({
                title: '请输入有效的手机号',
                icon: 'none'
            });
            return;
        }
        wx.showToast({
            title: '提交成功',
            icon: 'success'
        });
    },
    validatePhone: function(phone) {
        const phoneRegex = /^1[3-9]\d{9}$/;
        return phoneRegex.test(phone);
    }
});